package com.realgodo.site.web.user.communication;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springside.modules.orm.Page;

import com.realgodo.site.entity.application.Application;
import com.realgodo.site.entity.application.communication.Commentary;
import com.realgodo.site.service.application.ApplicationManager;
import com.realgodo.site.service.communication.CommentaryManager;
import com.realgodo.site.web.user.UserDefaultController;

@Scope("prototype")
public class IndexController extends UserDefaultController {

	/** */
	private static final long serialVersionUID = -5295864110211481613L;
	
	@Autowired
	protected ApplicationManager applicationManager;
	@Autowired
	protected CommentaryManager commentaryManager;
	
	/**被评论应用实体*/
	protected Application application;
	/** 评论分页信息 */
	protected Page<Commentary> commentaryPage;
	
	protected String moddle="";
	/**应用实体类型*/
	@SuppressWarnings("unchecked")
	private Class clasz;
	
	@Override
	/**进入评论页 ajax方式装载*/
	public String execute() throws Exception {
		super.getParamMap().put("applicationId", id);
		this.application=applicationManager.getApplication(id);
		commentaryPage=commentaryManager.find(PAGE_SIZE, super.getParamMap());
		super.setPageInfo(commentaryPage);
		super.getParamMap().put("moddle", moddle);
		return moddle==null||"".equals(moddle)?SUCCESS:moddle;
	}
	
	

	//------------------get/set---------//
	
	public Application getApplication() {
		return application;
	}

	public void setApplication(Application application) {
		this.application = application;
	}

	@SuppressWarnings("unchecked")
	public Class getClasz() {
		return clasz;
	}

	@SuppressWarnings("unchecked")
	public void setClasz(Class clasz) {
		this.clasz = clasz;
	}

	public Page<Commentary> getCommentaryPage() {
		return commentaryPage;
	}



	public String getModdle() {
		return moddle;
	}



	public void setModdle(String moddle) {
		this.moddle = moddle;
	}

	
	
	
	
}
